<?php
/**
 * @package docmanager
 * @category docmanager
 */

require_once("../../system.php");

$GO_SECURITY->authenticate();
$GO_MODULES->authenticate('docmanager');
require_once($GO_LANGUAGE->get_language_file('docmanager'));

load_basic_controls();

$page_title=$lang_modules['docmanager'];
require_once($GO_MODULES->class_path."docmanager.class.inc");
$docmanager = new docmanager();

$task = isset($_REQUEST['task']) ? $_REQUEST['task'] : '';
$docmanager_id = isset($_REQUEST['docmanager_id']) ? $_REQUEST['docmanager_id'] : 0;

$return_to = isset($_REQUEST['return_to']) ? $_REQUEST['return_to'] : $_SERVER['HTTP_REFERER'];
$link_back = isset($_REQUEST['link_back']) ? $_REQUEST['link_back'] : $_SERVER['REQUEST_URI'];


$tabstrip = new tabstrip('docmanager_tab', '查看文档');
$message = false;

$tabstrip->set_attribute('style','width:100%;height:300px');
$tabstrip->set_return_to(htmlspecialchars($return_to));

//check permissions of parent objects
$write_permission = true;
$read_permission = true;

if((!$write_permission && $message_id == 0) || !$read_permission)
{
	header('Location: '.$GO_CONFIG->host.'error_docs/403.php');
	exit();
}

$form = new form('docmanager_form');
$form->add_html_element(new input('hidden','close','false'));
$form->add_html_element(new input('hidden','docmanager_id',$message_id,false));
$form->add_html_element(new input('hidden','task','',false));
$form->add_html_element(new input('hidden','return_to',$return_to));
$form->add_html_element(new input('hidden','link_back',$link_back));
$form->add_html_element(new input('hidden','user_id',$user_id));

if (isset($feedback))
{
	$p = new html_element('p', $feedback);
	$p->set_attribute('class','Error');
	$tabstrip->add_html_element($p);
}

$maintable = new table();
$maintable->set_attribute('style','width:100%;height:100%;');
$mainrow = new table_row();
$maincell = new table_cell();
$maincell->set_attribute('valign','top');

$table = new table();
$row = new table_row();
// 发送至
$row->add_cell(new table_cell('文档名称'.':部门审查'));
$table->add_row($row);
// 文档名
$row = new table_row();		
	
$table->add_row($row);	
		
$maincell->add_html_element($table);
$mainrow->add_cell($maincell);

$maincell = new table_cell();
$maincell->set_attribute('valign','top');

$table = new table();
$row = new table_row();
$row->add_cell(new table_cell($strCreatedAt.':'));
$row->add_cell(new table_cell($ctime));
$table->add_row($row);

$row = new table_row();
$row->add_cell(new table_cell($strModifiedAt.':'));
$row->add_cell(new table_cell($mtime));
$table->add_row($row);

$maincell->add_html_element($table);
$mainrow->add_cell($maincell);
$maintable->add_row($mainrow);

$mainrow = new table_row();
$maincell= new table_cell();
$maincell->set_attribute('colspan','2');
$maincell->set_attribute('style','width:100%;height:100%;');
		
$table = new table();
$row = new table_row();
		
$row->add_cell(new table_heading('字段名'));
$row->add_cell(new table_heading('字段类型'));
$row->add_cell(new table_heading('长度'));
$table->add_row($row);
		
$row = new table_row();
		
// 字段名
$cell = new table_cell('申请担保金额');
$cell->set_attribute('style','width: 400px');
$row->add_cell($cell);
// 字段类型
$cell = new table_cell('文本');
$cell->set_attribute('style','width: 200px');
$row->add_cell($cell);
// 字段长度
$cell = new table_cell('10');
$cell->set_attribute('style','width: 200px');
$row->add_cell($cell);

$table->add_row($row);
			
$maincell->add_html_element($table);
$mainrow->add_cell($maincell);
$maintable->add_row($mainrow);

$mainrow = new table_row();
$maincell= new table_cell();
$maincell->set_attribute('colspan','2');

$maincell->add_html_element(new button($cmdClose, "javascript:document.location='".htmlspecialchars($return_to)."';"));
$mainrow->add_cell($maincell);
$maintable->add_row($mainrow);

$tabstrip->add_html_element($maintable);

$form->add_html_element($tabstrip);
require_once($GO_THEME->theme_path."header.inc");
echo $form->get_html();

?>
<script type="text/javascript">

function _save(task, close)
{
	document.docmanager_form.task.value = task;
	document.docmanager_form.close.value = close;
	document.docmanager_form.submit();
}
document.docmanager_form.name.focus();
</script>
<?php
require_once($GO_THEME->theme_path."footer.inc");
